import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from "../views/Login";
import ArticleList from "../components/article/ArticleList";
import ArticleRelease from "../components/article/ArticleRelease";
import CategoryManage from "../components/category/CategoryManage";
import UserManage from "../components/user/UserManage";
import DataStatistics from "../components/data/DataStatistics";


Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Login',
        component: Login,
        hidden : true
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        hidden : true
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        meta : {
            hasChild : true,
            title : '文章管理',
            icon : 'fa fa-file font-margin',
            roles : ['ROLE_admin','ROLE_dba','ROLE_user']
        },
        children : [
            {
                path: '/ArticleList',
                name: 'ArticleList',
                component: ArticleList,
                meta : {
                    title : '文章列表',
                    roles : ['ROLE_admin','ROLE_dba','ROLE_user']
                }
            },
            {
                path: '/ArticleRelease',
                name: 'ArticleRelease',
                component: ArticleRelease,
                meta : {
                    title : '文章发布',
                    roles : ['ROLE_admin','ROLE_dba','ROLE_user']
                }
            },
        ]
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        meta : {
            hasChild : false
        },
        children : [
            {
                path: '/CategoryManage',
                name: 'CategoryManage',
                component: CategoryManage,
                meta : {
                    title : '栏目管理',
                    icon :'fa fa-th-large font-margin',
                    roles : ['ROLE_admin','ROLE_dba']
                }
            },
            {
                path: '/UserManage',
                name: 'UserManage',
                component: UserManage,
                meta : {
                    title : '用户管理',
                    icon :'fa fa-user-circle-o font-margin',
                    roles : ['ROLE_admin','ROLE_dba']
                }
            },
            {
                path: '/DataStatistics',
                name: 'DataStatistics',
                component: DataStatistics,
                meta : {
                    title : '数据统计',
                    icon :'fa fa-bar-chart font-margin',
                    roles : ['ROLE_admin','ROLE_dba','ROLE_user']
                }
            },
        ]
    },
]

const router = new VueRouter({
    routes
})

export default router
